package com.sweather.quarze;

import java.text.ParseException;

import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;

public class QuarzSchedulingCron {
	

	public static  void main(String arg[])
		    throws SchedulerException, ParseException{
			
			SchedulerFactory schedulerFactory = new StdSchedulerFactory();
			Scheduler scheduler = schedulerFactory.getScheduler();
			
			JobDetail jobDetail = new JobDetail("QuartzJob",Scheduler.DEFAULT_GROUP,QuartzJob.class);
			
			String cronExpression = "0 0 0/1 * * ? *";
			//  0 0 0/1 * * ? *    一小时         0 1/2 * * * ?  两分钟
			
			CronTrigger cronTrigger = new CronTrigger("cronTrigger",Scheduler.DEFAULT_GROUP,cronExpression);
			
			scheduler.scheduleJob(jobDetail,cronTrigger);
			
			scheduler.start();
	}
}